package com.foreknow.demo12;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @author shkstart
 * @create 2021-07-30 11:01
 */
public class ArrayListDemo {
    public void m1(List<Student> list){
        for (int i = 0; i <list.size(); i++) {
            System.out.println(list.get(i).toString());
        }
    }

    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("请输入姓名");
        String name=input.next();
        System.out.println("请输入年龄");
        int age=input.nextInt();

        Student stu=new Student();
        stu.setName(name);
        stu.setAge(age);
        List<Student> list=new ArrayList<>();
        list.add(stu);
        ArrayListDemo arrayListDemo=new ArrayListDemo();
        arrayListDemo.m1(list);
    }
}
